﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ServiceModel;

namespace BankServiceHost {

    public partial class BankServiceHostForm : Form {

        private BankServiceHost<BankService.BankService, BankService.ServiceInterface.IBankService> host;

        public BankServiceHostForm() {
            InitializeComponent();

            this.FormClosing += new FormClosingEventHandler(BankServiceHostForm_FormClosing);

            NetTcpBinding netTcpBinding = new NetTcpBinding();
            netTcpBinding.Security.Mode = SecurityMode.None;
            host = new BankServiceHost<BankService.BankService, BankService.ServiceInterface.IBankService>(
                "net.tcp://localhost:5588/BankService",
                "Service",
                netTcpBinding);
            host.Start();
        }

        void BankServiceHostForm_FormClosing(object sender, FormClosingEventArgs e) {
            host.Stop();
        }
    }
}
